package study.concurrent.lock.support.utils;

public class RedisKeys {

    private static final String DELIMITER = ":";

    public static String format(String... parts) {
        if (parts == null || parts.length == 0) {
            return "";
        }
        StringBuffer sb = new StringBuffer();
        for (String part : parts) {
            sb.append(DELIMITER).append(part);
        }
        return sb.substring(1);
    }

    public static String lockOf(String key) {
        return format("redis", "lock", key);
    }
}
